from keras.models import load_model
import numpy as np
import cv2.cv2 as cv
model=load_model('cnn_model2.h5')
image=cv.imread('2.png',0)
img=cv.imread('2.png',0)
img=np.reshape(img,(1,28,28,1)).astype(bool).astype('float32')/255
my_predict=model.predict(img)
my_predict=np.argmax(my_predict,axis=1)
print('识别为：')
print(my_predict)
cv.imshow('Image1',image)
cv.waitKey(0)